<template>
  <div class="commentItem">
    <item v-if="parent.parent" :parent="parent.parent"></item>
    <div class="top">
      <div class="left">
        <span>{{ parent.user.nickname }}</span> &nbsp;&nbsp;&nbsp;
        <span>{{ parent.create_date }}</span>
      </div>
      <span>回复</span>
    </div>
    <div class="bottom">{{ parent.content }}</div>
  </div>
</template>

<script>
export default {
  // 使用递归 item 的值可以直接当标签来渲染数据
  name: "item",
  // 调用这个组件时，评论数据的parent
  props: ["parent"],
};
</script>

<style lang='less' scoped>
.commentItem {
  border: 1px solid #ccc;
  padding: 5px;
  margin-top: 10px;
  .top {
    font-size: 12px;
    color: #aaa;
    display: flex;
    justify-content: space-between;
  }
  .bottom {
    font-size: 13px;
    line-height: 40px;
  }
}
</style>